# -*- coding: utf-8 -*-
'''
@File    :   capability_3_vue.py
@Time    :   2025/09/05 09:10:45
@Author  :   LX
@Version :   1.0.0
@Desc    :   使用vue页面做ui


python simple_by_vue.py register

# 启动服务
python simple_by_vue.py server


首页:
http://127.0.0.1:5000



post接口:
http://127.0.0.1:5000/capability/simple_by_vue/methods/function1

return:
{
	"code": 0,
	"message": "[function1]成功"
}

http://127.0.0.1:5000/capability/simple_by_vue/methods/function2

{
    "xxx": "eeeeee"
}

return:
{
	"code": 0,
	"message": "[function2]成功,params:{'xxx': 'eeeeee'}"
}

'''

import os , sys
# 获取当前文件所在目录的上两级目录（即 src/common）
current_dir = os.path.dirname(os.path.abspath(__file__))
common_dir = os.path.abspath(os.path.join(current_dir,'..', '..','src'))
sys.path.append(common_dir)

from pycapabilitydecorator  import capability


@capability.init(
    # debug=True,
    static_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'vueproject' , 'dist',"static"),
    templates_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)),'vueproject' , 'dist'),

    # 路由类型 vue
    routes_type = "vue",
)
# ---- 最简单能力接入
@capability.option()
def function1():
    return {
        "code": 0,
        "message": "[function1]成功"
    }

@capability.option()
def function2(params):
    return {
        "code": 0,
        "message": f"[function2]成功,params:{params}"
    }
